<?php

/* Calculate the ID value that should be displayed with the table */

if ($edit_selected=='' && $_POST['Submit']!='Plain Text Edit' && $_POST['Submit']!='Form Edit') {

	if (mysql_query("ALTER TABLE " . $tableName ." AUTO_INCREMENT=1")) {
	$q = "select MAX(id) from $tableName";
	$id_result = mysql_query($q);
	$data = mysql_fetch_array($id_result);
	if ($data) {
		$plain[0] = $data[0]+1;
	}
	}

}
/* Code from: http://my-sliit.blogspot.ca/2008/08/how-to-get-max-id-row-from-mysql-table.html*/
?>
